var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/print/util.ts
var util_exports = {};
__export(util_exports, {
  SharePolicyEnum: () => SharePolicyEnum,
  commonStyle: () => commonStyle,
  info: () => info,
  wfAlert: () => wfAlert,
  wfModal: () => wfModal
});
module.exports = __toCommonJS(util_exports);
var import_functionalComponent = require("../../functionalComponent");
var info = {
  alertTitle: "提示",
  paramError: "参数不正确！",
  selectTemplate: "请选择模板",
  selectOneData: "请至少选择一条数据",
  noCallBack: "未传入callback函数，无法执行回调！",
  templateCode: "编码",
  name: "名称",
  remark: "说明",
  sharePolicy: "共享策略",
  shareTenant: "单元组织",
  group: "集团共享",
  cu: "单元共享",
  org: "组织私有",
  previewType: "预览方式(下拉选择)",
  searchEmptyText: "请输入名称",
  createPrintTitile: "选择打印模板",
  printError: "打印失败"
};
var commonStyle = {
  borderStyle: {
    borderRadius: "var(--border-radius-base, 2px)",
    border: "1px solid var(--border-color-base, #f0f0f0)"
  },
  backgroundStyle: {
    backgroundColor: "var(--component-background, #ffffff)"
  }
};
function wfModal(props) {
  return new Promise((resolve) => {
    const { onOk, onCancel, ...others } = props;
    const oldDestroy = (0, import_functionalComponent.showModal)({
      closable: false,
      ...others,
      onOk: async (ins) => {
        ins.destroy = () => {
          resolve(ins.getApi().getOkData ? ins.getApi().getOkData() : true);
          oldDestroy();
        };
        if (onOk) {
          await onOk(ins);
        } else if (ins.getApi().invokeOkHandler) {
          await ins.getApi().invokeOkHandler();
        } else {
          ins.destroy();
        }
      },
      onCancel: async (ins) => {
        ins.destroy = () => {
          resolve(ins.getApi().getCancelData ? ins.getApi().getCancelData() : false);
          oldDestroy();
        };
        if (onCancel) {
          await onCancel(ins);
        } else if (ins.getApi().invokeCancelHandler) {
          await ins.getApi().invokeCancelHandler();
        } else {
          ins.destroy();
        }
      }
    }).destroy;
  });
}
function wfAlert(title, content) {
  return new Promise((resolve) => {
    import_functionalComponent.Modal.info({
      title: title || info.alertTitle,
      zIndex: 1001,
      content,
      afterClose: () => {
        resolve("close");
      }
    });
  });
}
var SharePolicyEnum = /* @__PURE__ */ ((SharePolicyEnum2) => {
  SharePolicyEnum2[SharePolicyEnum2["GROUP"] = 0] = "GROUP";
  SharePolicyEnum2[SharePolicyEnum2["CU"] = 1] = "CU";
  SharePolicyEnum2[SharePolicyEnum2["ORG"] = 2] = "ORG";
  return SharePolicyEnum2;
})(SharePolicyEnum || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  SharePolicyEnum,
  commonStyle,
  info,
  wfAlert,
  wfModal
});
